<html>
<head><meta charset="utf-8"><title>Fixing errors in #82091 · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html">Fixing errors in #82091</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226381017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226381017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226381017">(Feb 15 2021 at 13:02)</a>:</h4>
<p>Hello everyone! I'm working on cleaning up <code>visit_projection</code> and some of its associated functions in the MIR. I've been debugging for a while but don't really know how to solve these <code>mismatched types</code> errors <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>. I'm not really sure why they are happening or how to fix them. Any help would be appreciated! (The code is on <a href="https://github.com/rust-lang/rust/issues/82091">#82091</a>, errors are <a href="https://github.com/rust-lang/rust/pull/82091#issuecomment-779183372">here</a>)</p>



<a name="226389094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226389094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226389094">(Feb 15 2021 at 14:16)</a>:</h4>
<p><span class="user-mention" data-user-id="383558">@Henry Boisdequin</span> the error is buried in the macro expansion:</p>
<div class="codehilite"><pre><span></span><code>383  | |                             &amp;mut place.as_ref(),
     | |                             ^^^^^^^^^^^^^^^^^^^ expected struct `mir::PlaceRef`, found `&amp;mir::Place&lt;&#39;_&gt;`

390  | |                             &amp;mut place.as_ref(),
     | |                             ^^^^^^^^^^^^^^^^^^^ expected struct `mir::PlaceRef`, found `&amp;mir::Place&lt;&#39;_&gt;`
</code></pre></div>
<p>I don't know this code well enough to help, but does that give you enough info to get started?</p>



<a name="226390649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226390649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226390649">(Feb 15 2021 at 14:31)</a>:</h4>
<p>I don't really know why that's happening though as I turn the <code>Place</code> into a <code>PlaceRef</code> by calling <code>.as_ref()</code></p>



<a name="226393050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226393050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226393050">(Feb 15 2021 at 14:54)</a>:</h4>
<p>hmm, do you have the <code>AsRef</code> trait in scope maybe?</p>



<a name="226393093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226393093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226393093">(Feb 15 2021 at 14:54)</a>:</h4>
<p>although I would expect the inherent method to take precedence <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="226400008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226400008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226400008">(Feb 15 2021 at 15:54)</a>:</h4>
<p>Errors aside, as far as I can see, it won't be possible to replace &amp;mut Place with &amp;mut PlaceRef in mutable visitor, since it takes away the ability to actually change the place (the modified PlaceRef is merely a temporary).</p>



<a name="226402302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226402302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226402302">(Feb 15 2021 at 16:06)</a>:</h4>
<p>I would probably keep <code>visit_place</code> and <code>super_place</code> as is, and change <code>visit_projection</code> which is used by non-mut visitor only.</p>



<a name="226461129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226461129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226461129">(Feb 16 2021 at 01:13)</a>:</h4>
<p>Ok thanks <span class="user-mention" data-user-id="352985">@tm</span></p>



<a name="226461188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Fixing%20errors%20in%20%2382091/near/226461188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Henry Boisdequin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Fixing.20errors.20in.20.2382091.html#226461188">(Feb 16 2021 at 01:14)</a>:</h4>
<p>Yeah, changing <code>visit_place</code> and <code>super_place</code> would mean changing and refactoring a lot more enums and structs to take a <code>PlaceRef</code> instead of a <code>Place</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>